Partition Array into Disjoint Intervals